import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTextArea;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class EITerapeutaGehitu extends JFrame {

	private JPanel contentPane;
	private JTextField nanSartu;
	private JTextField izenaSartu;
	private JTextField abizenaSartu;
	private JTextField espezialitateaSartu;
	private JTextField pasahitzaSartu;
	private JButton gehitu;
	private JButton atzera;
	private JButton logout;
	
	public EITerapeutaGehitu() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 900, 600);
		setVisible(true);
		elementuakHasieratu();
		botoiakHasieratu();
	}

	private void botoiakHasieratu() {
		gehitu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				String nan = nanSartu.getText();
				String izena = izenaSartu.getText();
				String abizena = abizenaSartu.getText();
				String pasahitza = pasahitzaSartu.getText();
				String esp = espezialitateaSartu.getText();
				Terapeuta t = new Terapeuta(nan, izena, abizena, pasahitza, esp);
				TerapeutaKudeatzailea.getInstantzia().terapeutaGehitu(t);
			}
		});
		
		
		atzera.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				//EIIdazkari frame = new EIIdazkari();
				EITerapeutakKudeatu frame = new EITerapeutakKudeatu();
				EITerapeutaGehitu.this.dispose();
			}
		});
		
		logout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				EILogin frame = new EILogin();
				EITerapeutaGehitu.this.dispose();
			}
		});
		
	}

	private void elementuakHasieratu() {
		
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblTerapeutaBerriarenDatuak = new JLabel("TERAPEUTA BERRIAREN DATUAK:");
		lblTerapeutaBerriarenDatuak.setBounds(382, 32, 253, 15);
		contentPane.add(lblTerapeutaBerriarenDatuak);
		
		JLabel lblNan = new JLabel("NAN:");
		lblNan.setBounds(351, 83, 70, 15);
		contentPane.add(lblNan);
		
		JLabel lblIzena = new JLabel("Izena:");
		lblIzena.setBounds(351, 138, 70, 15);
		contentPane.add(lblIzena);
		
		JLabel lblAbizena = new JLabel("Abizena");
		lblAbizena.setBounds(351, 198, 70, 15);
		contentPane.add(lblAbizena);
		
		JLabel lblEspezialitatea = new JLabel("Espezialitatea:");
		lblEspezialitatea.setBounds(351, 270, 121, 15);
		contentPane.add(lblEspezialitatea);
		
		nanSartu = new JTextField();
		nanSartu.setBounds(477, 81, 155, 19);
		contentPane.add(nanSartu);
		nanSartu.setColumns(10);
		
		izenaSartu = new JTextField();
		izenaSartu.setBounds(477, 136, 155, 19);
		contentPane.add(izenaSartu);
		izenaSartu.setColumns(10);
		
		abizenaSartu= new JTextField();
		abizenaSartu.setBounds(477, 198, 155, 19);
		contentPane.add(abizenaSartu);
		abizenaSartu.setColumns(10);
		
		espezialitateaSartu = new JTextField();
		espezialitateaSartu.setBounds(477, 268, 155, 19);
		contentPane.add(espezialitateaSartu);
		espezialitateaSartu.setColumns(10);
		
		logout = new JButton("Logout");
		logout.setBounds(763, 7, 117, 25);
		contentPane.add(logout);
		
		atzera = new JButton("Atzera");
		atzera.setBounds(763, 522, 117, 25);
		contentPane.add(atzera);
		
		JLabel lblPasahitza = new JLabel("Pasahitza:");
		lblPasahitza.setBounds(351, 330, 85, 15);
		contentPane.add(lblPasahitza);
		
		pasahitzaSartu = new JTextField();
		pasahitzaSartu.setBounds(477, 328, 155, 19);
		contentPane.add(pasahitzaSartu);
		pasahitzaSartu.setColumns(10);
		
		gehitu = new JButton("Gehitu");
		gehitu.setBounds(448, 426, 117, 25);
		contentPane.add(gehitu);
		
	}
}
